<?php 
include "connect.php";
$date=$_POST['date'];
//$ssaid=$_POST['ssaid'];
$class_id=$_POST['class_id'];
$subject_id=$_POST['subject_id'];
$total_marks=$_POST['total_marks'];
$teacher_id=$_POST['teacher_id'];
$sess=$_POST['sess'];


$dbquery=mysql_query ("INSERT INTO student_subject_attendance (date,class_id,subject_id,teacher_id,session_id) 
VALUES ('$date','$class_id','$subject_id','$teacher_id','$sess')") or die(mysql_error());


$ssaid = mysql_insert_id();
$sql2=mysql_query("select * from student_subject where session_id=' $sess' AND class_id='$class_id' AND subject_id='$subject_id'" );


while($row=mysql_fetch_array($sql2))
{
$roll=$row['roll_no'];
$present=$_POST[$roll];


$sql=mysql_query("insert into student_subject_attendance_detail (ssa_id,roll_no,present) VALUES ('$ssaid','$roll','$present')") or die (mysql_error());

}


header("location:student subject attendence tea.php");

?>